package com.xcjh.eums;

import java.util.Objects;

/**
 * 部门状态
 */
public enum AppType {

    /**
     * 正常
     */
    ZHENAI("zhenai","珍爱"),
    /**
     * jiayuan
     */
    JIAYUAN("jiayuan","佳缘"),
    /**
     * MARRAY
     */
    MARRAY("marray","marray"),
    /**
     * YIDUI
     */
    YIDUI("yidui","依对"),

    ;

    private String code;
    private String message;

    private AppType(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static AppType findByKey(String key) {

        AppType result = null;

        for (AppType s : values()) {
            if (Objects.equals(s.getCode(), key)) {
                result = s;
                break;
            }
        }

        return result;
    }

    public static AppType findByMsg(String msg) {

        AppType result = null;

        for (AppType s : values()) {
            if (s.getMessage().equals(msg)) {
                result = s;
                break;
            }
        }

        return result;
    }
}